package com.croot.infra.${projectFlag}.dto.request;

import com.croot.infra.${projectFlag}.adapter.rdb.po.${entityName}PO;
import org.apache.commons.lang3.StringUtils;
import java.util.Objects;
import lombok.Data;

@Data
public class ${entityName}ReqDTO {

<#list columnInfos as column>
   <#if column.humpColumnName ?ends_with("id")
    || column.humpColumnName ?ends_with("Id")
   >
    private String ${column.humpColumnName!};

    <#elseif
    column.humpColumnName != "createTime"
    && column.humpColumnName != "creator"
    && column.humpColumnName != "updateTime"
    && column.humpColumnName != "updater"
    && column.humpColumnName != "delFlag"
    >
    private ${column.humpColumnNameType!} ${column.humpColumnName!};

   </#if>
</#list>
    private Integer pageNo;

    private Integer pageSize;

    public ${entityName}PO convertToPO() {
        ${entityName}PO ${entityParamName}PO = new ${entityName}PO();

<#list columnInfos as column>
    <#if column.humpColumnName != "createTime"
    && column.humpColumnName != "creator"
    && column.humpColumnName != "updateTime"
    && column.humpColumnName != "updater"
    && column.humpColumnName != "delFlag"
   >
        if (Objects.nonNull(this.${column.humpColumnName!})) {
    <#if column.humpColumnName ?ends_with("id")
    || column.humpColumnName ?ends_with("Id")>
            ${entityParamName}PO.set${column.humpColumnName! ? cap_first}(Long.parseLong(this.${column.humpColumnName!}));
    <#else>
        <#if column.humpColumnNameType == "String">
            ${entityParamName}PO.set${column.humpColumnName! ? cap_first}(StringUtils.deleteWhitespace(this.${column.humpColumnName!}));
        <#else>
            ${entityParamName}PO.set${column.humpColumnName! ? cap_first}(this.${column.humpColumnName!});
        </#if>
    </#if>
        }
    </#if>
</#list>

        return ${entityParamName}PO;
    }

}
